﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.SharePoint;
using Microsoft.SharePoint.Security;

namespace SPBusiness.ExtensionMethods
{
    public static class ExtSPWeb
    {

        public static SPFile TryGetFileByUrl(this SPWeb vSPWeb, string vServerRelativeUrl)
        {
            SPFile vSPFile = null;

            try
            {
                vSPFile = vSPWeb.GetFile(vServerRelativeUrl);

                if (!vSPFile.Exists)
                {
                    vSPFile = null;
                }
            }
            catch { }

            return vSPFile;
        }

    }
}
